﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using MySql.Data.MySqlClient;
namespace DAL
{
    public class fresh_statisticsDal
    {
        /// <summary>
        /// 统计查询
        /// </summary>
        /// <param name="mid"></param>
        /// <returns></returns>
        public static List<ms_fresh_statistics> Querycount(string mid)
        {
            string sql = "select count(*) as count,fs_fgname from ms_fresh_statistics where fs_merchant_id=@fs_merchant_id and fs_create=CURDATE() group by fs_fgname";
            MySqlParameter[] values = new MySqlParameter[1];
            values[0] = new MySqlParameter("fs_merchant_id", mid);
            MySqlDataReader rd = DBHelper.ExcutQuery(sql, values);
            List<ms_fresh_statistics> stlist = new List<ms_fresh_statistics>();
            while (rd.Read())
            {
                ms_fresh_statistics mst = new ms_fresh_statistics();
                mst.count = rd["count"].ToString();
                mst.fs_fgname = rd["fs_fgname"].ToString();
                stlist.Add(mst);
            }
            rd.Close();
            return stlist;
                
        }
    }
}
